<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- 视口标签 -->
<meta name="viewport"
	content="width=device-width, initial-scale=1, user-scalable=no" />
<!-- 删除苹果默认的工具栏和菜单栏 -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- 设置苹果工具栏颜色 -->
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- 忽略页面中的数字识别为电话，忽略email识别 -->
<meta name="format-detection" content="telphone=no, email=no" />
<!-- 启用360浏览器的极速模式(webkit) -->
<meta name="renderer" content="webkit">
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
<meta name="HandheldFriendly" content="true">
<!-- 微软的老式浏览器 -->
<meta name="MobileOptimized" content="320">
<!-- uc强制竖屏 -->
<meta name="screen-orientation" content="portrait">
<!-- QQ强制竖屏 -->
<meta name="x5-orientation" content="portrait">
<!-- UC应用模式 -->
<meta name="browsermode" content="application">
<!-- QQ应用模式 -->
<meta name="x5-page-mode" content="app">
<!-- windows phone 点击无高光 -->
<meta name="msapplication-tap-highlight" content="no">
<!-- 适应移动端end -->
<link rel="stylesheet" type="text/css"
	href="${path }/resource/css/base.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/resource/css/index.css" />
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/plugin/TouchSlide.1.1.js"></script>
<title>我的资料</title>
<style type="text/css">
#login_form .color_h{
	display: inline-block;
    width: 60px;
}
.checkbox {
  min-height: 24px;
  position: relative;
  float: right;
}

input[type="checkbox"]:checked,
input[type="checkbox"]:not(:checked) {
  box-sizing: border-box;
  left: 4px;
  margin: 0;
  padding: 0;
  position: absolute;
  top: 3px;
}

input[type="checkbox"]:checked + label,
input[type="checkbox"]:not(:checked) + label {
  background-color: #e0e0e0;
  border-radius: 24px;
  cursor: pointer;
  display: inline-block;
  height: 24px;
  position: relative;
  text-indent: -9999px;
  -webkit-transition: background-color 0.3s;
          transition: background-color 0.3s;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  width: 48px;
}

input[type="checkbox"]:checked + label:after,
input[type="checkbox"]:not(:checked) + label:after {
  background-color: #fff;
  border-radius: 20px;
  content: " ";
  height: 20px;
  left: 2px;
  position: absolute;
  top: 2px;
  -webkit-transition: -webkit-transform 0.3s;
       -o-transition:      -o-transform 0.3s;
          transition:         transform 0.3s;
  width: 20px;
}

input[type="checkbox"]:checked + label {
  background-color: #8c8;
}

input[type="checkbox"]:checked + label:after {
  -webkit-transform: translateX(24px);
      -ms-transform: translateX(24px);
       -o-transform: translateX(24px);
          transform: translateX(24px);
}
</style>
</head>
<body>
	<div class="wrap">
		<section class="login_content">
			<form action="" class="login_form" id="login_form">
				<div onclick="MTools.chooesFile('#fileText')" style="text-align: center;margin-bottom: 10px"><img id="desHeadimgurl" src="${designer.desHeadimgurl}" class="border" alt="头像" style="width: 3.88rem;height: 3.88rem;border-radius: 1.94rem;"></div>
				<input type="hidden" name="desHeadimgurl" value="${designer.desHeadimgurl}">
				<div class="login_txt bor-t">
					<span class="color_h">名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称：</span>
					<input type="text" placeholder="请输入名称" name="desName" value="${designer.desName}"/>
				</div>
				<div class="login_txt">
					<span class="color_h">工&nbsp;作&nbsp;室：</span> 
					<input type="text" placeholder="请输入工作室" name="desStudio" value="${designer.desStudio}"/>
				</div>
				<div class="login_txt">
					<span class="color_h">设计价格：</span> 
					<input type="text" placeholder="请输入设计价格" name="desPrice" value="${designer.desPrice}"/><span style="float: right;color: #999;">元/平方米</span>
				</div>
				<div class="login_txt">
					<span style="color: #999;">是否展示联系方式：</span>
					<div class="checkbox">
						<input type="hidden" name="isShowTel">
						<input class="css-checkbox" id="isShowTel" type="checkbox" 
						<c:if test="${designer.isShowTel eq 'on'}"> checked="checked"</c:if>
						>
						<label for="isShowTel">Check</label>
					</div>
				</div>
				<div class="login_btn" onclick="doEditInfo()">
					<a href="javascript:;">保&nbsp;&nbsp;&nbsp;存</a>
				</div>
				<div class="login_btn" style="margin-top: 1.2rem;" onclick="window.location.href='${path}/app/users/toEditPassword'">
					<a href="javascript:;">修改密码</a>
				</div>
			</form>
		</section>
		
		<form class="form form-horizontal" method="post" style="display: none;"
			enctype="multipart/form-data" target="blankFrame"
			action="${path }/admin/uploadFile/doUpload?fileType=image&callBack=upcallback&inputId=desHeadimgurl">
	
			<input id="fileText" type="file" multiple="multiple" name="file-1"
				onchange="MTools.selectFile('#showFileName','#fileText','#submitBtn')" />
				
			<input type="submit" id="submitBtn" />
		</form>
		<iframe src="" name="blankFrame" id="blankFrame" style="display: none;"> </iframe>
	</div>
	<script type="text/javascript"
		src="${path }/resource/plugin/layer/layer.js"></script>
	<script type="text/javascript"
		src="${path }/resource/js/systools/MTools.js"></script>
	<script type="text/javascript">
	
	//上传文件回调
	function upcallback(inputId, url) {
		$('#desHeadimgurl').attr('src', url);
		$('input[name="desHeadimgurl"]').val(url);
	}
	
	function doEditInfo() {
		
		var flag = true;
		if(isBlank($('input[name="desName"]').val())) {
			flag = false;
			layer.tips("名称不能为空", $('input[name="desName"]')[0], {tips:1});
			return false;
		}
		if(!flag) {
			return false;
		} else {
			console.log($('#isShowTel'));
			if(document.getElementById('isShowTel').checked) {
				$('input[name="isShowTel"]').val('on');
			} else {
				$('input[name="isShowTel"]').val('off');
			}
			$.ajax({
				type : 'POST',
				url : '${path}/app/users/doEditInfo',
				data : $('#login_form').serialize(),
				dataType : 'json',
				async : false,
				success : function(res) {
					if (res && res.status == 'ok') {
						layer.msg(res.info, {
							icon : 1,
							time : 1000
						});
						setTimeout("window.location.replace('${path}/app/users/toUserIndex');", 1000);
					} else {
						layer.msg(res.info, {
							icon : 2,
							time : 1000
						});
					}
				}
			})
		}
	}
	/**判断是否为空*/
	function isBlank(obj) {
		return (!obj || $.trim(obj) === "");
	}
	</script>
</body>
</html>